package com.hongxun.design.bean;

import com.hongxun.design.MyApp;
import com.hongxun.design.mytools.MString;

/**
 * Created by zerdoor_pc on 2016/6/8.
 */
public class SearchProjectBean {

    public String project_id;
    public String uuid="";
    public String project_name;
    public String lng;
    public String lat;
    public String num = "0";
    public String is_finish = "0";

    public String thumb;
    public String project_type;
    public String codeset_version_id;

    public String stage;//,隔开
    public String stage_ids;//,隔开

    public String schedule;//,隔开
    public String create_time;//,隔开
    public String is_exp;//,隔开
    public String flag="";//,隔开

    public String manager = "";
    public String explorationer = "";
    public String designer = "";
    public String auditor = "";
    public String cost_center = "";
    public String current_stage = "";

    /**加删除标记**/
    public void setDelFlagBean(ProjectItemBean bean){
        String[] tar = stage_ids.split(",");
        String[] tar2;
        if (flag.length()>0){
          tar2 = flag.split(",");
        }else{
            tar2=new String[tar.length];
            for (int i=0;i<tar.length;i++){
              tar2[i]=MString.nodel;
            }
        }
        for (int i=0;i<tar.length;i++){
            if (tar[i].equals(bean.getStage_id())){
                tar2[i]=MString.del;
            }
        }
        flag="";
        for (int i=0;i<tar2.length;i++){
           flag+=tar2[i]+",";
       }
        flag=flag.substring(0,flag.length()-1);
    }
    /**删除全部**/
    public void setDelBean(ProjectItemBean bean){
        replace(schedule,bean.getCurrent_schedule());
        replace(is_exp,bean.getIs_exp());
        replace(create_time,bean.getCreate_time());
        replace(stage,bean.getStage());
        replace(stage_ids,bean.getStage_id());
    }

    private void replace(String old,String news){
        try {
            if (old.contains(news)&&old.contains(news+",")){
                old=old.replace(news+",","");
            }else if (old.contains(news)&&!old.contains(news+",")){
                old=old.replace(news,"");
            }
        }catch (Exception e){}
    }
    public void setBean(ProjectItemBean bean){
        if (bean==null)return;
        clear();
        project_id = bean.getProject_id();
        project_name = bean.getProject_name();
        lng = bean.getLng();
        lat = bean.getLat();
        thumb = bean.getThumb();
        project_type = bean.getProject_type();
        is_finish = bean.getIs_finish();
        codeset_version_id = bean.getCodeset_version_id();

        //stage_name=bean.getStage();
        schedule = bean.getCurrent_schedule();
        is_exp = bean.getIs_exp();
        create_time = bean.getCreate_time();
        stage = bean.getStage();
        stage_ids = bean.getStage_id();
        manager = bean.getManager();
        explorationer = bean.getExplorationer();
        designer = bean.getDesigner();
        auditor = bean.getAuditor();
        uuid = bean.getUUID();
        flag=bean.getFlag();
        cost_center=bean.getCost_center();
        current_stage=bean.getCurrent_stage();
        if (is_exp.equals(MString.code_zero)) {
            MyApp.ReadOnly = false;
        } else if (is_exp.equals(MString.code_one)){
            MyApp.ReadOnly = true;
        }else{
            is_exp=MString.code_zero;
            MyApp.ReadOnly = false;
        }
    }

    public void clear(){
          project_id="";
          uuid="";
         project_name="";
         lng="";
         lat="";
         num = "0";
         is_finish = "0";

         thumb="";
         project_type="";
         codeset_version_id="";

         stage="";//,隔开
         stage_ids="";//,隔开

         schedule="";//,隔开
         create_time="";//,隔开
         is_exp="";//,隔开
         flag="";//,隔开

         manager = "";
         explorationer = "";
         designer = "";
         auditor = "";
        cost_center = "";
        current_stage = "";
    }

    public String getCurrent_stage() {
        return current_stage;
    }

    public void setCurrent_stage(String current_stage) {
        this.current_stage = current_stage;
    }

    public String getCost_center() {
        return cost_center;
    }

    public void setCost_center(String cost_center) {
        this.cost_center = cost_center;
    }

    public String getFlag() {
        return flag;
    }

    public void setFlag(String flag) {
        this.flag = flag;
    }

    public String getUUID() {
        return uuid;
    }

    public void setUUID(String uuid) {
        this.uuid = uuid;
    }

    public String getManager() {
        return manager;
    }

    public void setManager(String manager) {
        this.manager = manager;
    }

    public String getExplorationer() {
        return explorationer;
    }

    public void setExplorationer(String explorationer) {
        this.explorationer = explorationer;
    }

    public String getDesigner() {
        return designer;
    }

    public void setDesigner(String designer) {
        this.designer = designer;
    }

    public String getAuditor() {
        return auditor;
    }

    public void setAuditor(String auditor) {
        this.auditor = auditor;
    }

    public String getIs_finish() {
        return is_finish;
    }

    public void setIs_finish(String is_finish) {
        this.is_finish = is_finish;
    }

    public String getProject_id() {
        return project_id;
    }

    public void setProject_id(String project_id) {
        this.project_id = project_id;
    }

    public String getProject_name() {
        return project_name;
    }

    public void setProject_name(String project_name) {
        this.project_name = project_name;
    }

    public String getLng() {
        return lng;
    }

    public void setLng(String lng) {
        this.lng = lng;
    }

    public String getLat() {
        return lat;
    }

    public void setLat(String lat) {
        this.lat = lat;
    }

    public String getNum() {
        return num;
    }

    public void setNum(String num) {
        this.num = num;
    }

    public String getStage() {
        return stage;
    }

    public void setStage(String stage) {
        this.stage = stage;
    }

    public String getStage_ids() {
        return stage_ids;
    }

    public void setStage_ids(String stage_ids) {
        this.stage_ids = stage_ids;
    }

    public String getThumb() {
        return thumb;
    }

    public void setThumb(String thumb) {
        this.thumb = thumb;
    }

    public String getProject_type() {
        return project_type;
    }

    public void setProject_type(String project_type) {
        this.project_type = project_type;
    }

    public String getCodeset_version_id() {
        return codeset_version_id;
    }

    public void setCodeset_version_id(String codeset_version_id) {
        this.codeset_version_id = codeset_version_id;
    }

    public String getSchedule() {
        return schedule;
    }

    public void setSchedule(String schedule) {
        this.schedule = schedule;
    }

    public String getCreate_time() {
        return create_time;
    }

    public void setCreate_time(String create_time) {
        this.create_time = create_time;
    }

    public String getIs_exp() {
        return is_exp;
    }

    public void setIs_exp(String is_exp) {
        this.is_exp = is_exp;
    }
}
